package flirtme.server;

import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import flirtme.constants.Constants;

public class FlirtMeRestClient {
    
  private static AsyncHttpClient client = new AsyncHttpClient();

  public static void get(String method, RequestParams params, AsyncHttpResponseHandler responseHandler) {
      client.get(getAbsolutUrl(method), params, responseHandler);
  }

  public static void post(String method, RequestParams params, AsyncHttpResponseHandler responseHandler) {
      client.post(getAbsolutUrl(method), params, responseHandler);
  }
  
  public static String getAbsolutUrl(String method) {
	  String url = Constants.SERVER_URL + "method=" + method; 
	  return url;
  }

public static String getFullHttpUrl(String url) {
	String fullUrl = url;
	if (!url.contains("http")) {
		fullUrl = "http://" + url;
	}
	return fullUrl;
	
}
}